package com.yannie.smp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yannie.smp.mapper.UserMapper;
import com.yannie.smp.model.User;
import com.yannie.smp.service.UserService;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService{

	@Autowired
	private UserMapper userMapper;
	
	@Override
	public List<User> findUserByAddress(User user) {
		EntityWrapper<User> wrapper = (EntityWrapper<User>) new EntityWrapper<User>().eq("address", user.getAddress());
		List<User> users = this.selectList(wrapper);
		return users;
	}

	@Override
	public User findUserById(Integer id) {
		User user = userMapper.findUserById(id);
		return user;
	}
}
